using IQIGame.Onigao.Framework.Serialization;
using System.Collections.Generic;

namespace IQIGame.Onigao.Game
{
    public partial class CFSMStateCfg
    {
        public int id;
        public string name;
        public List<int> conditions;
        public List<NamedParam> customParams;

        public struct NamedParam : ISerializeByteBuf
        {
            public int nameType;
            public CFSMParamType type;
            public object value;

            public void DeSerialize(ByteBuf _buf)
            {
                nameType = _buf.ReadInt();
                CFSMParamType type = (CFSMParamType)_buf.ReadByte();
                value = CFSMSerializeUtil.ReadValueByType(_buf, type);
            }

            public void Serialize(ByteBuf _buf)
            {
                _buf.WriteInt(nameType);
                _buf.WriteByte((byte)type);
                CFSMSerializeUtil.WriteValueByType(_buf, type, value);
            }
        }
    }
}